<div class="layui-fluid" >
    <div class="layui-card">
        <div class="layui-card-body" style="padding: 15px;">
            <form class="layui-form" action="" lay-filter="addForm">
                <div class="layui-form-item">
                    <label class="layui-form-label"><span style="color: red">*</span>用户名</label>
                    <div class="layui-input-block">
                        <input type="text" name="username" lay-verify="required" autocomplete="off" placeholder="请输入用户名" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">富文本</label>
                    <div class="layui-input-block">
                        <textarea name="" id="edit" cols="30" rows="10"></textarea>
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-input-block">
                        <a class="layui-btn" lay-submit="" lay-filter="addNewsSubmit">立即提交</a>
                        <a class="layui-btn layui-btn-primary" id="close">关闭</a>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>

<script>
    var AddNews = function (admin,form,index,$,tinymce) {
        //初始化
        this.init = function () {
            var edit = tinymce.render({
                elem: "#edit"
                , height: 600
            });

            /* 监听提交 */
            form.on('submit(addNewsSubmit)', function (data) {
                console.log(edit.getContent())
                return false;
            });

        };
    };
    //引入组件
    layui.use(['admin', 'table', 'form', 'jquery','tinymce'], function (admin, table, form, $,tinymce) {
        var addNews = new AddNews(admin, table, form, $,tinymce);
        addNews.init();
    });
</script>